﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml.Serialization;

namespace SilverlightTetris_M10CDE.Web
{
    public class Score : IComparable
    {
        public String name { get; set; }
        public String score { get; set; }
        public String lines { get; set; }
        public String levelReached { get; set; }
        public String timeTaken { get; set; }
        public String date;

        public Score(String name, String score, String lines, String levelReached, String timeTaken, String date )
        {
            this.name = name;
            this.score = score;
            this.lines = lines;
            this.levelReached = levelReached;
            this.timeTaken = timeTaken;
            this.date = date;  
        }

        /// <summary>
        /// Empty constructor
        /// </summary>
        public Score()
        {
            this.date = DateTime.Today.ToLongDateString();
        }


        /// <summary>
        /// pretty basic tostring method
        /// </summary>
        /// <returns>a string of this objects contents</returns>
        public String toString()
        {
            return name + " " + score + " " + date + System.Environment.NewLine;
        }

        public int CompareTo(object obj)
        {
            Score Compare = (Score)obj;
            int result = this.score.CompareTo(Compare.score);
            if (result == 0)
                result = this.score.CompareTo(Compare.score);
            return result;
        }

    }

}